<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script type="text/javascript" src="../js/jquery.js"></script>
    <script type="text/javascript" src="../bootstrap/js/bootstrap.js"></script>
    <script type="text/javascript" src="../js/myUtil.js"></script>

    <link rel="stylesheet" type="text/css" href="../bootstrap/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="../bootstrap/css/bootstrap-theme.css">
    <link rel="stylesheet" type="text/css" href="../css/page.css">

</head>
<body>
    <div class="container-fluid">

        <div class="row" style="height: 200px; background: #666666">
            <label class="col-md-12" id="userName" style="color: white; font-size: 30px; text-align: center"></label>
            <label class="col-md-12" id="userRole" style="color: white; font-size: 25px; text-align: center"></label>
            <label class="col-md-12" id="userResume" style="color: white; font-size: 20px; text-align: center"></label>
        </div>
        <div class="row" style="text-align: center; margin-bottom: 50px"><img class="img-circle" src="head.jpeg" style="width: 100px; height: 100px" id="userHead" alt="头像"></div>

        <!--用户创建的贴吧与帖子-->
        <div class="row" id="userCreate"></div>
    </div>

    <script type="text/javascript">
        let thisUser;
        let userId;

        getUserId();
        function getUserId()
        {
            let url=location.href;
            let tmp1=url.split("?")[1];
            let tmp2=tmp1.split("&")[0];
            userId = tmp2.split("=")[1];

            // 请求得到用户信息
            $.post("/QG_PostBar/user?method=getUserById", {"userId": userId}, function (data){
                thisUser = data;
                $("#user").html(thisUser.userName + "（我）");
                if (thisUser.userHead != null) {
                    $("#userHead").attr("src", "/QG_PostBar/user_head/" + thisUser.userHead);
                }
                $("#userName").html(thisUser.userName);
                $("#userRole").html(thisUser.userRole === 0 ? "普通用户": "系统管理员");
                $("#userResume").html(thisUser.userResume);

                getUserPostBar();
            }, "json");
        }

        // 显示用户贴吧
        function getUserPostBar() {
            $("#userCreate").load("userPostBar.html", function (){
                user = thisUser;
                getPostBarNumber();
                getPagePostBar();
                $(".navigationBar").hide();
                $("#userPostBarDiv").attr("class", "col-md-12");
            });
        }

    </script>
</body>
</html>